package com.lagou.service;

import com.lagou.dao.UserDao;
import com.lagou.factory.UserDaoFactory;
import com.lagou.model.Student;
import com.lagou.model.User;

import java.util.List;

public class UserServiceImpl implements UserService {
    private UserDao dao;

    public UserServiceImpl(){
        this.dao = UserDaoFactory.getUserDao();
    }
    /**
     * 定义成员方法实现登录
     */
    public User userLoginSerivce(User user){
        return dao.userLogin(user);
    }

    @Override
    public List<Student> showStudentService() {
        return dao.showAllUser();
    }

    @Override
    public boolean addStudent(Student student) {
        return dao.addStudent(student);
    }

    @Override
    public boolean deleteStudent(Integer id) {
        return dao.deleteStudent(id);
    }

    @Override
    public boolean updateStudent(Student student) {
        return dao.updateStudent(student);
    }

    @Override
    public Student findStudentById(Integer id) {
        return dao.findStudentById(id);
    }
}
